package com.alex.projects.bitcask.core;

import com.alex.projects.bitcask.api.KeyIndexEntry;
import com.alex.projects.bitcask.api.StoreKey;

import java.util.HashMap;

public class KeyIndexService {

    private HashMap<StoreKey, KeyIndexEntry> map;

    public KeyIndexService() {
        map = new HashMap<>();
    }

    public KeyIndexEntry getIndex(StoreKey key){
        return map.get(key);
    }

    public KeyIndexEntry getIndex(String keyStr){
        StoreKey key = new StoreKey(keyStr);
        return map.get(key);
    }

    public void putIndex(StoreKey key,KeyIndexEntry indexEntry){
        map.put(key, indexEntry);
    }
}
